from die import Die
import plotly.express as px

die_1 = Die()
die_2 = Die()

results = []
for roll_num in range(1000):
    result = die_1.roll()+die_2.roll()
    results.append(result)
# print(results)

frequencies = []
max_result=die_1.num_sides+die_2.num_sides
poss_results = range(2, max_result+1)
for value in poss_results:
    frequency = results.count(value)
    frequencies.append(frequency)
# print(frequencies)
title = "results of rolling two D6 1000 times"
labels = {'x': 'result', 'y': 'frequency of result'}
fig = px.bar(x=poss_results, y=frequencies, title=title, labels=labels)
fig.show()
fig.write_json('123123.json','wb')